/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.repository.memory;

import com.playground.core.repository.QueueRepository;
import com.playground.core.entity.GameTitle;
import com.playground.core.entity.Queue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 *
 * @author Tiago Peres
 */
@Service("queueRepository")
public class QueueRepositoryImpl implements QueueRepository {
    private static HashMap<GameTitle, Queue> queues = new HashMap<GameTitle, Queue>();

    public Queue save(Queue queue) {
        queues.put(queue.getGameTitle(), queue);
        return queue;
    }

    public Queue getQueueByGameTitle(GameTitle gameTitle) {
        return queues.get(gameTitle);
    }

    public List<Queue> findAll() {
        return new ArrayList(queues.values());
    }

    public void deleteAll() {
        queues = new HashMap<GameTitle, Queue>();
    }
    
}
